package com.java.dao.Impl;

import com.java.dao.AddLine;
import com.java.dao.AllAirLine;
import com.java.entity.AirLine;
import com.java.util.C3P0Util;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class AllAirLineImpl implements AllAirLine {
    private QueryRunner qr=new QueryRunner(C3P0Util.getDataSource());

    @Override
    public List<AirLine> selectAirLine(AirLine airLine) throws SQLException {
        List<AirLine> airLines=new ArrayList<>();
        if(airLine ==null){
            String sql="select * from f_airLine";
           airLines = qr.query(sql, new BeanListHandler<AirLine>(AirLine.class));
        }
        return airLines;
    }
}
